package com.mac.hosp_pre.admin.controller;

import com.mac.hosp_pre.admin.service.DepartmentService;
import com.mac.hosp_pre.admin.model.resp.DeptTreeRespDto;
import com.mac.hosp_pre.reply.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "科室管理接口")
@RestController
@RequestMapping("/admin/hosp/dept")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @Operation(summary = "查询医院所有科室列表")
    @Parameter(name = "hospCode", description = "医院编号", in = ParameterIn.PATH)
    @GetMapping("getDeptList/{hospCode}")
    public R getDeptList(@PathVariable String hospCode) {
        List<DeptTreeRespDto> deptTree = departmentService.findDeptTree(hospCode);
        return R.success(deptTree);
    }
}
